﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace C4F.DevKit.Calendar
{
    /// <summary>
    /// A class which represents a reminder for an appointment.
    /// </summary>
    public class Reminder
    {
        #region Private Members

        private Guid _UID;

        private TimeSpan _triggerSpan;

        private DateTime _triggerDate;

        private bool _isAbsolute;

        private List<string> _extraProperties;


        #endregion

        #region Public Constructors

        /// <summary>
        /// Creates a new Reminder.
        /// </summary>
        public Reminder()
        {
            _UID = Guid.NewGuid();
            ExtraProperties = new List<string>();
        }

        #endregion

        #region Internal Properties

        internal List<string> ExtraProperties
        {
            get
            {
                return _extraProperties;
            }
            set
            {
                _extraProperties = value;
            }
        }

        #endregion

        #region Public Properties

        /// <summary>
        /// The amount of time before the event that the reminder is triggered.
        /// </summary>
        public TimeSpan Trigger
        {
            get
            {
                return _triggerSpan;
            }
            
            set
            {
                _triggerSpan = value;
                _isAbsolute = false;
            }
        }

        /// <summary>
        /// The date on which the reminder should be triggered.
        /// </summary>
        public DateTime OnDateTrigger
        {
            get
            {
                return _triggerDate;
            }

            set
            {
                _triggerDate = value;
                _isAbsolute = true;
            }
        }

        /// <summary>
        /// Whether or not this reminder is absolute (goes off at a certain date,
        /// independent of the appointment date), or relative (goes off at a time
        /// relative to the start of the appointment).
        /// </summary>
        public bool IsAbsoluteTrigger
        {
            get
            {
                return _isAbsolute;
            }
        }

        /// <summary>
        /// The unique identifier for the alarm.
        /// </summary>
        public Guid UID
        {
            get
            {
                return _UID;
            }
        }         

        #endregion

        #region Internal Methods

        internal void SetUID(Guid uid)
        {
            _UID = uid;
        }

        #endregion
    }
}
